//V[hQ[Wől
let ShieldGauge_Max = 1000;
//`[WQ[Wől
let ChargeGauge_Max = 1000;
//XRAlől
let ScorePoint_Max = 99999;

/**
 * V[hQ[WZ
 * 
 * @param { Integer } point Z|Cg
 */
function AddShieldGauge( point ){
	let gauge = GetShieldGauge() + point;
	if( gauge > ShieldGauge_Max ){
		gauge = ShieldGauge_Max;
	}
	SetCommonDataEx( "OFT", "ShieldGauge", gauge );
}

/**
 * V[hQ[WZ
 * 
 * @param { Integer } point Z|Cg
 */
function SubShieldGauge( point ){
	let gauge = GetShieldGauge() - point;
	if( gauge < 0 ){
		gauge = 0;
	}
	SetCommonDataEx( "OFT", "ShieldGauge", gauge );
}

/**
 * V[hQ[W擾
 */
function GetShieldGauge(){
	if( IsCommonDataAreaExists( "OFT" ) ){
		return GetCommonDataDefaultEx( "OFT", "ShieldGauge", 0 );
	}else{
		return 0;
	}
}

/**
 * `[WQ[WZ
 * 
 * @param { Integer } point Z|Cg
 */
function AddChargeGauge( point ){
	let gauge = GetChargeGauge() + point;
	if( GetNowChargeCount() >= GetMaxChargeCount() ){
		gauge = 0;
	}
	if( gauge > ChargeGauge_Max ){
		AddNowChargeCount( 1 );
		gauge -= ChargeGauge_Max;
	}
	SetCommonDataEx( "OFT", "ChargeGauge", gauge );
}

/**
 * `[WQ[WZ
 * 
 * @param { Integer } point Z|Cg
 */
function SubChargeGauge( point ){
	let gauge = GetChargeGauge() - point;
	if( gauge < 0 ){
		gauge = 0;
	}
	SetCommonDataEx( "OFT", "ChargeGauge", gauge );
}

/**
 * ݃`[WZ
 * 
 * @param { Integer } point Z`[W
 */
function AddNowChargeCount( point ){
	let count = GetNowChargeCount() + point;
	if( count > GetMaxChargeCount() ){
		count = GetMaxChargeCount();
	}
	SetCommonDataEx( "OFT", "NowChargeCount", count );
}

/**
 * ݃`[WZ
 * 
 * @param { Integer } point Z`[W
 */
function SubNowChargeCount( point ){
	let count = GetNowChargeCount() - point;
	if( count < 0 ){
		count = 0;
	}
	SetCommonDataEx( "OFT", "NowChargeCount", count );
}

/**
 * ő`[Wݒ
 * 
 * @param { Integer } point ݒ肷`[W
 */
function SetMaxChargeCount( count ){
	SetCommonDataEx( "OFT", "MaxChargeCount", count );
}

/**
 * `[WQ[W擾
 */
function GetChargeGauge(){
	if( IsCommonDataAreaExists( "OFT" ) ){
		return GetCommonDataDefaultEx( "OFT", "ChargeGauge", 0 );
	}else{
		return 0;
	}
}

/**
 * ݃`[W擾
 */
function GetNowChargeCount(){
	if( IsCommonDataAreaExists( "OFT" ) ){
		return GetCommonDataDefaultEx( "OFT", "NowChargeCount", 0 );
	}else{
		return 0;
	}
}

/**
 * ő`[W擾
 */
function GetMaxChargeCount(){
	if( IsCommonDataAreaExists( "OFT" ) ){
		return GetCommonDataDefaultEx( "OFT", "MaxChargeCount", 0 );
	}else{
		return 0;
	}
}

/**
 * {GNXehlQ[WZ
 * 
 * @param { Integer } point Z{GNXehl
 */
function AddBombExtendPoint( point ){
	let gauge = GetBombExtendPoint() + point;
	if( gauge > GetBombExtendNormaPoint() ){
		//{ACe쐬
		//VOioAACeǗōs킹
		SetCommonDataEx( "OFT", "BombExtendSignal", true );
		
		gauge -= GetBombExtendNormaPoint();
	}
	SetCommonDataEx( "OFT", "BombExtendPoint", gauge );
}

/**
 * {GNXehlQ[WZ
 * 
 * @param { Integer } point Z{GNXehl
 */
function SubBombExtendPoint( point ){
	let gauge = GetBombExtendPoint() - point;
	if( gauge < 0 ){
		gauge = 0;
	}
	SetCommonDataEx( "OFT", "BombExtendPoint", gauge );
}

/**
 * {GNXehl擾
 */
function GetBombExtendPoint(){
	if( IsCommonDataAreaExists( "OFT" ) ){
		return GetCommonDataDefaultEx( "OFT", "BombExtendPoint", 0 );
	}else{
		return 0;
	}
}

/**
 * {GNXehm}lݒ
 * 
 * @param { Integer } point ݒ肷{GNXehm}l
 */
function SetBombExtendNormaPoint( point ){
	SetCommonDataEx( "OFT", "BombExtendNormaPoint", point );
}

/**
 * {GNXehm}l擾
 */
function GetBombExtendNormaPoint(){
	if( IsCommonDataAreaExists( "OFT" ) ){
		return GetCommonDataDefaultEx( "OFT", "BombExtendNormaPoint", 0 );
	}else{
		return 0;
	}
}

/**
 * XRAlQ[WZ
 * 
 * @param { Integer } point ZXRAl
 */
function AddScorePoint( point ){
	let gauge = GetScorePoint() + point;
	if( gauge > ScorePoint_Max ){
		gauge = ScorePoint_Max;
	}
	SetCommonDataEx( "OFT", "ScorePoint", gauge );
}

/**
 * XRAlQ[WZ
 * 
 * @param { Integer } point ZXRAl
 */
function SubScorePoint( point ){
	let gauge = GetScorePoint() - point;
	if( gauge < 1 ){
		gauge = 1;
	}
	SetCommonDataEx( "OFT", "ScorePoint", gauge );
}

/**
 * XRAl擾
 */
function GetScorePoint(){
	if( IsCommonDataAreaExists( "OFT" ) ){
		return GetCommonDataDefaultEx( "OFT", "ScorePoint", 1 );
	}else{
		return 1;
	}
}
